<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>#{msg.registrazioneMarchioTitle}</title>
    </h:head>
    <h:body>
        <div class="container">
            <ui:include src="Header.xhtml"/>
            <div class="content">
                <h3><p:outputLabel value="#{msg.registrazioneMarchio}" /></h3>
                <p:messages id="messaggio" autoUpdate="true" closable="true" />
                <h:form enctype="multipart/form-data" >
                    <h4><p:outputLabel value="#{msg.marchioIstruzioni}"/></h4>
                    <h:panelGrid id="grid" columns="2">
                        <p:outputLabel for="foto" value="#{msg.caricaFoto}"/>
                        <p:fileUpload id="foto" mode="advance" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" sizeLimit="#{msg.fotoSizeLimit}"
                                      invalidFileMessage="#{msg.fotoFormatM}" invalidSizeMessage="#{msg.fotoDimensioneM}" label="#{msg.fotoForm}"
                                      uploadLabel="#{msg.confermaDati}" multiple="true" fileUploadListener="#{marchio.registraMarchio}" update="table" cancelLabel="#{msg.cancellaForm}"/>
                    </h:panelGrid>
                    <hr/>
                    <p:dataTable id="table" value="#{marchio.marchi}" var="m">
                        <p:column headerText="#{msg.idTable}">
                            <p:outputLabel value="#{m.id}"/>
                        </p:column>
                        <p:column headerText="#{msg.fotoTable}">
                            <p:graphicImage value="#{m.foto.fotoPath()}" width="70" height="50" />
                        </p:column>
                        <p:column headerText="#{msg.nomeTable}">
                            <p:outputLabel value="#{m.nome}"/>
                        </p:column>
                    </p:dataTable> 
                </h:form>
            </div>
            <ui:include src="Footer.xhtml"/>
        </div>
    </h:body>
</html>

